﻿#define _CRT_SECURE_NO_WARNINGS//倒序语句:hello world-->world hello
#include <stdio.h>
#include <assert.h>
#include <string.h>

void reverse(char* left, char* right)
{
	assert(left);
	assert(right);

	while (left < right)
	{
		char tmp = *left;
		*left = *right;
		*right = tmp;
		left++;
		right--;
	}
}

int main()
{
	char arr[101] = { 0 };
	gets(arr);
	//处理
	char* cur = arr;
	//逆序每个单词
	while (*cur)
	{
		char* start = cur;
		char* end = cur;
		while (*end != ' ' && *end != '\0')
		{
			end++;
		}
		reverse(start, end - 1);
		if (*end != '\0')
			cur = end + 1;
		else
			cur = end;
	}
	//逆序整个字符串
	int len = strlen(arr);
	reverse(arr, arr + len - 1);

	printf("%s\n", arr);

	return 0;
}




//void fun() {
//	char arr[100];
//	if (scanf("%s", arr) != EOF) {
//		fun();
//		printf("%s ", arr);
//	}
//}
//
//int main() {
//	fun();
//	return 0;
//}
